﻿@using KMF.WebUI.Areas.KMFadmin.Models
@using KMF.WebUI.Areas.KMFadmin.CustomHelpers
@model KMF.Common.OrderDto
@{
    ViewBag.Title = "Chi tiết đơn hàng";
    Layout = "~/Areas/KMFadmin/Views/Shared/_layout.cshtml";
    var ListDetail = (List<KMF.Common.OrderDetailProductDto>)ViewBag.OrderDetail;
}

<link href="~/Areas/KMFadmin/Content/css/browerImage.css" rel="stylesheet" />
<link href="~/Areas/KMFadmin/Scripts/jQueryDatePicker/css/ui-lightness/jquery-ui-1.10.1.custom.min.css" rel="stylesheet" />
<link href="~/Areas/KMFadmin/Scripts/jQueryDatePicker/js/jquery-ui-timepicker-addon.css" rel="stylesheet" />
@section LeftMenu
{
    <div id="left">
        <div class="LeftMenuWraper">
            <div class="leftMenuHeader">
                <span style="padding-left: 10px;">
                    <strong>Truy cập nhanh</strong>
                </span>
            </div>
            <ul id="p-quick-menu" class="quick-menu">
                <li class="qmn-info-pro">
                    <a href="@Url.Action("Index", "AdminCustomer")">Khách hàng</a>
                </li>
                <li class="qmn-seo-pro">
                    <a href="@Url.Action("Index", "AdminOrder")">Đơn hàng</a>
                </li>
            </ul>
            <div class="leftMenuFooter"></div>
        </div>
    </div>
    <!-- END #left -->
}
<nav>
    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li><a href="@Url.Action("Index","AdminHome")"><i class="bootstrap icon-home"></i></a></li>
            <li><a href="javascript:void(0)">Danh sách đơn hàng</a> </li>
        </ul>
    </div>
</nav>
<div class="toolBox">
    @Html.ToolBox(new List<object> { new Back { ClassCss = "Back", ActionName = "/KMFadmin//AdminOrder/Index" } })
</div>
<div>
    <strong>Thông tin đơn hàng</strong>
</div>
<table class="table-odd">
    <tr>
        <th style="width:200px;">Mã đơn hàng</th>
        <td style="text-align:left;">@Model.OrderId</td>
    </tr>
    <tr>
        <th>Ngày nhận</th>
        <td style="text-align:left;">@Model.ReceiveDate.ToString("dd/MM/yyyy")</td>
    </tr>
    <tr>
        <th>Tên khách hàng</th>
        <td style="text-align:left;">@Model.FullName</td>
    </tr>
    <tr>
        <th>Email:</th>
        <td style="text-align:left;">@Model.Email</td>
    </tr>
    <tr>
        <th>Số đt</th>
        <td style="text-align:left;">@Model.MobilePhone</td>
    </tr>
    <tr>
        <th>Địa chỉ</th>
        <td style="text-align:left;">@Model.Address</td>
    </tr>
    <tr>
        <th>Tỉnh/Thành phố</th>
        <td style="text-align:left;">@Model.ProvinceName</td>
    </tr>
    <tr>
        <th>Quận huyện</th>
        <td style="text-align:left;">@Model.DistrictName</td>
    </tr>
    <tr>
        <th>Tổng tiền</th>
        <td style="text-align:left;color:#ff0000;font-weight:bold;">@Model.TotalMoney.ToString("##,###") vnđ</td>
    </tr>
</table>

<div style="margin-top:10px;">
    <strong>Các sản phẩm</strong>
</div>

@if (ListDetail.Any())
{
    var count = 0;
    <table class="table-odd table-plist">
        <tr>
            <th style="width:30px;">STT</th>
            <th style="width: 40px;">Ảnh</th>
            <th style="width:80px;">Mã SP</th>
            <th>Tên SP</th>
            <th style="width:100px;">Số Lượng</th>
            <th style="width:100px;">Giá</th>
        </tr>
        @foreach (var item in ListDetail)
        {
            count++;
            <tr>
                <td style="text-align:center;">@count</td>
                <td style="text-align:center;"><img src="@item.ImagePath.ImagePathThumb(35, 35)" /></td>
                <td>
                    @item.Barcode
                </td>
                <td>
                    <a href="">@item.Name</a>
                </td>
                <td>
                    @item.Quantity
                </td>
                <td>@item.Price.ToString("##,###") vnđ</td>
            </tr>
        }
    </table>
}


@section scripts
{
    @Scripts.Render("~/bundles/KMFAdmin/jqueryval")
    <script src="@Url.Content("~/Areas/KMFadmin/Scripts/jQueryDatePicker/js/jquery-ui-1.10.1.custom.min.js")"></script>
    <script src="@Url.Content("~/Areas/KMFadmin/Scripts/jQueryDatePicker/js/jquery-ui-timepicker-addon.js")"></script>
    @*<script type="text/javascript">
            $('#btnFilterOder').click(function () {
                var s = $('.plcFillter #StartDate').val();
                var e = $('.plcFillter #EndDate').val();
                if (s != '' && e != '') {
                    location.href = '/Order/Filter/?StartDate=' + s + '&EndDate=' + e;
                }
            });

            function DeleteOrder(id) {
                $.ajax({
                    url: '/Order/DeleteOrder',
                    data: { id: id },
                    success: function (data) {
                        if (data) {
                            alert('Xóa khách hàng thành công!');
                            window.location = '/Color';
                        } else {
                            alert('Xóa khách hàng thất bại!');
                        }
                    },
                    error: function () {
                        alert('Đã có lỗi xảy ra!');
                    }
                });
            }
            // ------------- Date picker -------
            $('#StartDate').datetimepicker({ dateFormat: 'dd/mm/yy', timeFormat: "hh:mm:ss tt", timeOnlyTitle: "Chọn thời gian", showTimepicker: false });
            $('#EndDate').datetimepicker({ dateFormat: 'dd/mm/yy', timeFormat: "hh:mm:ss tt", timeOnlyTitle: "Chọn thời gian", showTimepicker: false });
        </script>*@
}
